#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QImage>
#include <QTime>
#include <QtGlobal>
#include <QFileInfo>
#include <QKeyEvent>

#include <iostream>
using namespace std;
namespace Ui {
class MainWindow;
}


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void keyPressEvent(QKeyEvent *ev);

    void produceMap(unsigned char map[],unsigned char rmap[],int size);

    void produceMap(int map[],int size);

    void exLine();

    void initData();

    void exchangeLine(int line1,int line2);

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_loadbtn_clicked();
    
    void on_input_returnPressed();
    
    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

private:
    Ui::MainWindow *ui;
    QImage pic;
    QImage newPic;

    unsigned char mapR[256],rmapR[256];
    unsigned char mapG[256],rmapG[256];
    unsigned char mapB[256],rmapB[256];

    int linemap[4096];
    int linemapSize;
    bool isExchange;

    int changeTimes;
    QString imgname;
    QString lockname;
};

#endif // MAINWINDOW_H
